using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using Sinacor.Infra.Service.Security.Services;
using Sinacor.Servico.Bovespa.Parametro.Service.ServiceContract;

namespace Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation
{
    [SinacorServiceBehavior]
	public class ParametroBolsa : IParametroBolsa 
    {

        public ParametroBolsa() { }

		public void AlterarParametroBolsa(DataContract.Request.ParametroBolsaRequest request)
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.DataContractToBusinessEntity.ParametroBolsa _translator = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.ParametroBolsa();

            _businessLogic.AlterarParametroBolsa(_translator.ToParametroBolsa(request));
        }

		public void AlterarTipoNota(DataContract.Request.TipoNotaRequest parameter)
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.DataContractToBusinessEntity.ParametroBolsa _translator = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.ParametroBolsa();

            _businessLogic.AlterarTipoNota(_translator.ToTipoNota(parameter));
        }

		public void AlterarTiposNotas(List<DataContract.Request.TipoNotaRequest> requestList)
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.DataContractToBusinessEntity.ParametroBolsa _translator = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.ParametroBolsa();

            _businessLogic.AlterarTiposNotas(_translator.ToTipoNota(requestList));
		}

		public void AtualizarParametroBolsa(DataContract.Request.ParametroBolsaRequest parametroBolsaRequest, List<DataContract.Request.TipoNotaRequest> tiposNotasList)
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.DataContractToBusinessEntity.ParametroBolsa _translator = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.ParametroBolsa();

            _businessLogic.AtualizarParametroBolsa(_translator.ToParametroBolsa(parametroBolsaRequest), _translator.ToTipoNota(tiposNotasList));
		}

		public List<DataContract.Response.TipoNotaResponse> ConsultarTiposNotas(DataContract.Request.FiltroTipoNotaRequest parameter)
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.DataContractToBusinessEntity.ParametroBolsa _translatorDataContractToBusinessEntity = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.ParametroBolsa();
            Translator.BusinessEntityToDataContract.ParametroBolsa _translatorBusinessEntityToDataContract = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.BusinessEntityToDataContract.ParametroBolsa();

            return _translatorBusinessEntityToDataContract.ToTipoNotaResponse(_businessLogic.ConsultarTiposNotas(_translatorDataContractToBusinessEntity.ToFiltroTipoNota(parameter)));
		}

		public DataContract.Response.ParametroBolsaResponse ObterParametroBolsa()
        {
            Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa _businessLogic = new Sinacor.Servico.Bovespa.Parametro.BusinessLogic.ParametroBolsa();
            Translator.BusinessEntityToDataContract.ParametroBolsa _translatorBusinessEntityToDataContract = new Sinacor.Servico.Bovespa.Parametro.Service.ServiceImplementation.Translator.BusinessEntityToDataContract.ParametroBolsa();

            return _translatorBusinessEntityToDataContract.ToParametroBolsaResponse(_businessLogic.ObterParametroBolsa());
		}
	}
}